//
//  SAPUseCarThree.m
//  CarsHome
//
//  Created by dapeng on 15/12/8.
//  Copyright © 2015年 dapeng. All rights reserved.
//

#import "SAPUseCarThree.h"

@implementation SAPUseCarThree
- (void)dealloc {
    [_firstImage release];
    [_secondImage release];
    [_thirdImage release];
    [_topLabel release];
    [_footLabel release];
    [_commentLabel release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.secondImage = [[UIImageView alloc] init];
        self.topLabel = [[UILabel alloc] init];
        self.footLabel = [[UILabel alloc] init];
        self.commentLabel = [[UILabel alloc] init];
        [_topLabel release];
        [_footLabel release];
        [_commentLabel release];
        [_secondImage release];
        [self addSubview:self.secondImage];
        [self addSubview:self.topLabel];
        [self addSubview:self.footLabel];
        [self addSubview:self.commentLabel];
        [_topLabel release];
        [_footLabel release];
        [_commentLabel release];
        [_secondImage release];
        
    }return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    for (int i = 0; i < 3; i++) {
        self.secondImage.frame = CGRectMake((SCREEN_SIZE.width - 50) / 3 * i, 30, (SCREEN_SIZE.width - 60) / 3, 80);
    }
    self.topLabel.frame = CGRectMake(10, 10, SCREEN_SIZE.width, 20);
    self.footLabel.frame = CGRectMake(10, 100, 100, 15);
    self.commentLabel.frame = CGRectMake(SCREEN_SIZE.width - 80, 100, 80, 15);
}
- (void)setTwoModel:(SAPUseCarTwoModel *)twoModel {
    if (_twoModel != twoModel) {
        [_twoModel release];
        _twoModel = [twoModel retain];
        
    }
    NSString *str = [twoModel.indexdetail stringByReplacingOccurrencesOfString:@"㊣" withString:@""];
    str = [twoModel.indexdetail stringByReplacingOccurrencesOfString:@"3899㊣23619㊣" withString:@""];
    [self.secondImage sd_setImageWithURL:[NSURL URLWithString:str]];
    
    self.topLabel.text = twoModel.title;
    self.footLabel.text = twoModel.time;
    self.commentLabel.text = [NSString stringWithFormat:@"%@图片", twoModel.replycount];
    
    _footLabel.font = [UIFont systemFontOfSize:14];
    _commentLabel.font = [UIFont systemFontOfSize:14];
    _commentLabel.textAlignment = NSTextAlignmentRight;
    _footLabel.textColor = [UIColor grayColor];
    _commentLabel.textColor = [UIColor grayColor];
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
